﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>站内短信息 - {config.webname}</title>
<meta content="{config.webkeyword}" name="keywords" />
<meta content="{config.webdescription}" name="description" />
<link rel="stylesheet" href="{config.webpath}css/pagination.css" />
<link media="screen" type="text/css" href="<%templateskin%>/css/style.css" rel="stylesheet">
<script type="text/javascript" src="{config.webpath}scripts/jquery/jquery-1.10.2.min.js"></script>
<script type="text/javascript" src="{config.webpath}scripts/lhgdialog/lhgdialog.js?skin=idialog"></script>
<script type="text/javascript" src="<%templateskin%>/js/base.js"></script>
<script type="text/javascript">
	function ExecPostBack(checkValue) {
		if (arguments.length == 1) {
			ExecDelete('{config.webpath}tools/submit_ajax.ashx?action=user_message_delete', checkValue, 'turl');
		}else{
			var valueArr = '';
			$("input[name='checkId']:checked").each(function(i){
				valueArr += $(this).val();
				if(i < $("input[name='checkId']:checked").length - 1){
					valueArr += ","
				}
			});
			ExecDelete('{config.webpath}tools/submit_ajax.ashx?action=user_message_delete', valueArr, 'turl');
		}
    }
</script>
</head>

<body>
<!--Header-->
<%template src="_header.html"%>
<!--/Header-->

<div class="boxwrap">
  <div class="left180">
    <!--Sidebar-->
    <%template src="_ucenter_nav.html"%>
    <!--/Sidebar-->
  </div>
  
  <div class="right757">
    <h1 class="main_tit">
      <span><a href="<%linkurl("usercenter","index")%>">管理首页</a></span>
      站内短信
      <strong>Message</strong>
    </h1>
    <%if(action=="system")%>
    <!--系统消息-->
    <div class="tab_head">
      <a class="add" href="<%linkurl("usermessage","add")%>">+ 写新消息</a>
      <ul class="tabs">
        <li><a href="<%linkurl("usermessage","accept")%>">收件箱</a></li>
        <li class="selected"><a href="<%linkurl("usermessage","system")%>">系统消息</a></li>
        <li><a href="<%linkurl("usermessage","send")%>">发件箱</a></li>
      </ul>
    </div>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="mtable">
      <%set DataTable list1=get_user_message_list(10, page, "accept_user_name='"+userModel.user_name+"' and type=1", out totalcount)%> <!--取得一个DataTable-->
      <%set string pagelist1=get_page_link(10, page, totalcount, "usermessage1", action, "__id__")%> <!--取得分页页码列表-->
      <%loop dr list1%>
      <tr>
        <td width="20" align="center">
          <%if({dr[is_read]}=="1")%>
          <img title="已读" src="<%templateskin%>/images/pm_1.gif">
          <%else%>
          <img title="未读" src="<%templateskin%>/images/pm_0.gif">
          <%/if%>
        </td>
        <td width="20" align="center"><input name="checkId" class="checkall" type="checkbox" value="{dr[id]}" ></td>
        <td><a href="<%linkurl("usermessage_show",{dr[id]})%>">{dr[title]}</a></td>
        <td width="150">{dr[post_time]}</td>
        <td width="38"><a onclick="ExecPostBack('{dr[id]}');" href="javascript:;">删除</a></td>
      </tr>
      <%/loop%>
      <%if(totalcount<1)%>
      <tr><td align="center">暂无记录</td></tr>
      <%/if%>
    </table>
    
    <div class="page_foot">
      <div class="flickr right">{pagelist1}</div><!--放置页码列表-->
      <div class="page_btns">
        <a onclick="checkAll(this);" href="javascript:;">全选</a>
        <span class="pipe">|</span>
        <a onclick="ExecPostBack();" href="javascript:;">删除</a>
      </div>
    </div>
    <input id="turl" type="hidden" value="<%linkurl("usermessage","system")%>" />
    <!--系统消息-->
    
    <!--收件箱-->
    <%else if(action=="accept")%>
    <div class="tab_head">
      <a class="add" href="<%linkurl("usermessage","add")%>">+ 写新消息</a>
      <ul class="tabs">
        <li class="selected"><a href="<%linkurl("usermessage","accept")%>">收件箱</a></li>
        <li><a href="<%linkurl("usermessage","system")%>">系统消息</a></li>
        <li><a href="<%linkurl("usermessage","send")%>">发件箱</a></li>
      </ul>
    </div>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="mtable">
      <%set DataTable list2=get_user_message_list(10, page, "accept_user_name='"+userModel.user_name+"' and type=2", out totalcount)%> <!--取得一个DataTable-->
      <%set string pagelist2=get_page_link(10, page, totalcount, "usermessage1", action, "__id__")%> <!--取得分页页码列表-->
      <%loop dr list2%>
      <tr>
        <td width="20" align="center">
          <%if {dr[is_read]}=="1"%>
          <img title="已读" src="<%templateskin%>/images/pm_1.gif">
          <%else%>
          <img title="未读" src="<%templateskin%>/images/pm_0.gif">
          <%/if%>
        </td>
        <td width="20" align="center"><input name="checkId" class="checkall" type="checkbox" value="{dr[id]}" ></td>
        <td width="60" align="center">
          <%set string user_avatar=get_user_avatar({dr[post_user_name]})%>
          <%if(user_avatar=="")%>
          <img src="<%templateskin%>/images/user_avatar.png" width="48" height="48" />
          <%else%>
          <img src="{user_avatar}" width="48" height="48" alt="{dr[post_user_name]}" />
          <%/if%>
        </td>
        <td><strong>{dr[post_user_name]}</strong><br /><a href="<%linkurl("usermessage_show",{dr[id]})%>">{dr[title]}</a></td>
        <td width="150">{dr[post_time]}</td>
        <td width="30"><a onclick="ExecPostBack('{dr[id]}');" href="javascript:;">删除</a></td>
      </tr>
      <%/loop%>
      <%if(totalcount<1)%>
      <tr><td align="center">暂无记录</td></tr>
      <%/if%>
    </table>
    
    <div class="page_foot">
      <div class="flickr right">{pagelist2}</div><!--放置页码列表-->
      <div class="page_btns">
        <a onclick="checkAll(this);" href="javascript:;">全选</a>
        <span class="pipe">|</span>
        <a onclick="ExecPostBack();" href="javascript:;">删除</a>
      </div>
    </div>
    <input id="turl" type="hidden" value="<%linkurl("usermessage","accept")%>" />
    <!--/收件箱-->
    
    <%else if(action=="send")%>
    <!--发件箱-->
    <div class="tab_head">
      <a class="add" href="<%linkurl("usermessage","add")%>">+ 写新消息</a>
      <ul class="tabs">
        <li><a href="<%linkurl("usermessage","accept")%>">收件箱</a></li>
        <li><a href="<%linkurl("usermessage","system")%>">系统消息</a></li>
        <li class="selected"><a href="<%linkurl("usermessage","send")%>">发件箱</a></li>
      </ul>
    </div>
    <table width="100%" border="0" cellspacing="0" cellpadding="0" class="mtable">
      <%set DataTable list3=get_user_message_list(10, page, "post_user_name='"+userModel.user_name+"' and type=3", out totalcount)%> <!--取得一个DataTable-->
      <%set string pagelist3=get_page_link(10, page, totalcount, "usermessage1", action, "__id__")%> <!--取得分页页码列表-->
      <%loop dr list3%>
      <tr>
        <td width="20" align="center"><input name="checkId" class="checkall" type="checkbox" value="{dr[id]}" ></td>
        <td width="60" align="center">
          <%set string user_avatar=get_user_avatar({dr[accept_user_name]})%>
          <%if(user_avatar=="")%>
          <img src="<%templateskin%>/images/user_avatar.png" width="48" height="48" />
          <%else%>
          <img src="{user_avatar}" width="48" height="48" alt="{dr[accept_user_name]}" />
          <%/if%>
        </td>
        <td><strong>{dr[accept_user_name]}</strong><br /><a href="<%linkurl("usermessage_show",{dr[id]})%>">{dr[title]}</a></td>
        <td width="150">{dr[post_time]}</td>
        <td width="30"><a onclick="ExecPostBack('{dr[id]}');" href="javascript:;">删除</a></td>
      </tr>
      <%/loop%>
      <%if(totalcount<1)%>
      <tr><td align="center">暂无记录</td></tr>
      <%/if%>
    </table>
    
    <div class="page_foot">
      <div class="flickr right">{pagelist3}</div><!--放置页码列表-->
      <div class="page_btns">
        <a onclick="checkAll(this);" href="javascript:;">全选</a>
        <span class="pipe">|</span>
        <a onclick="ExecPostBack();" href="javascript:;">删除</a>
      </div>
    </div>
    <input id="turl" type="hidden" value="<%linkurl("usermessage","send")%>" />
    <!--、发件箱-->
    
    <%else if(action=="add")%>
    <!--发布短信息-->
    <link rel="stylesheet" href="{config.webpath}css/validate.css" />
	<script type="text/javascript" src="{config.webpath}scripts/jquery/jquery.form.min.js"></script>
    <script type="text/javascript" src="{config.webpath}scripts/jquery/Validform_v5.3.2_min.js"></script>
    <script type="text/javascript">
      $(function(){
	    //初始化表单
		AjaxInitForm('add_form', 'btnSubmit', 1, 'turl');
	  });
    </script>
    <div class="tab_head">
      <ul class="tabs">
        <li><a href="<%linkurl("usermessage","accept")%>">收件箱</a></li>
        <li><a href="<%linkurl("usermessage","system")%>">系统消息</a></li>
        <li><a href="<%linkurl("usermessage","send")%>">发件箱</a></li>
      </ul>
    </div>
    <div class="line10"></div>
    <form id="add_form" name="add_form" url="{config.webpath}tools/submit_ajax.ashx?action=user_message_add">
      <div class="form_box">
        <dl>
          <dt>收件人：</dt>
          <dd><input name="txtUserName" id="txtUserName" type="text" class="input txt" datatype="s1-50"  nullmsg="请填写收件人用户名" sucmsg=" " /></dd>
        </dl>
        <dl>
          <dt>标题：</dt>
          <dd><input name="txtTitle" id="txtTitle" type="text" class="input txt" datatype="*1-50" sucmsg=" " /></dd>
        </dl>
        <dl>
          <dt>内容：</dt>
          <dd><textarea name="txtContent" class="input required" style="width:250px;height:80px;" datatype="*" sucmsg=" "></textarea></dd>
        </dl>
        <dl>
          <dt></dt>
          <dd>
            <label><input name="sendSave" type="checkbox" value="true" checked="checked" />保存到发件箱</label></dd>
        </dl>
        <dl>
          <dt></dt>
          <dd>
            <input id="txtCode" name="txtCode" class="input small" type="text" datatype="*" sucmsg=" " style="ime-mode:disabled;text-transform:uppercase;">
              <a id="verifyCode" href="javascript:;" onclick="ToggleCode(this, '{config.webpath}tools/verify_code.ashx');return false;"><img src="{config.webpath}tools/verify_code.ashx" width="80" height="22" /> 看不清楚？</a>
          </dd>
        </dl>
        <dl>
          <dt></dt>
          <dd><input name="btnSubmit" id="btnSubmit" type="submit" class="btn_submit" value="确认发布" /></dd>
        </dl>
      </div>
    </form>
    <input id="turl" type="hidden" value="<%linkurl("usermessage","add")%>" />
    <!--/发布短信息-->
    <%/if%>
    
  </div>
</div>

<div class="clear"></div>

<!--Footer-->
<%template src="_footer.html"%>
<!--/Footer-->
</body>
</html>
